package org.mp4.decode;

import org.springframework.util.FileCopyUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @Version 1.0
 * @Author az
 * @Date 2024-05-08 16:43:38
 * @ClassName Mp4Decodes
 * @Description
 */
public class Mp4Decodes {

    public static void main(String[] args) throws IOException {
        File file = new File("F:\\work\\四川英特\\20240417192358_000019A.MP4");
        /*byte[] bytes = FileCopyUtils.copyToByteArray(file);

        do {
            while ()
        }

        int ftypsize = 0, mdatsize = 0, mdat_addr = 0, moov_addr = 0, mvhd_addr = 0;
         int strm1 = 0, strm2 = 0, strm3 = 0;
         int tkhd = 0, edts = 0, mdia = 0;
         int mdhd = 0, dinf = 0, stbl = 0;
         int stsd = 0, stts = 0, stsc = 0, stsz = 0, stco = 0;
         int size = 0, pos = 0, curpos = 0;
         char chSize[8] = new char[8];
        char chFlag[8] = new char[8];
        char rbuf[128] = new char[8];
        char date_s[16] = new char[8];
        char time_s[16] = new char[8];
        char gps_lat[16] = new char[8];
        char gps_lgt[16] = new char[8];
        char gps_spd[16] = new char[8];
        int k, check_flag = 0;
        
        
        for (int i = 0, j = bytes.length; i < j; i++) {
            if(fread(chSize, 1, 4, fd) != 4) break;		//get address
        }*/

        FileInputStream fis = new FileInputStream(file);

        /*do {
            int ftypsize = 0, mdatsize = 0, mdat_addr = 0, moov_addr = 0, mvhd_addr = 0;
            int strm1 = 0, strm2 = 0, strm3 = 0;
            int tkhd = 0, edts = 0, mdia = 0;
            int mdhd = 0, dinf = 0, stbl = 0;
            int stsd = 0, stts = 0, stsc = 0, stsz = 0, stco = 0;
            int size = 0, pos = 0, curpos = 0;
            int i, check_flag = 0;

            char chSize[] = new char[8];
            char chFlag[] = new char[8];
            char rbuf[] = new char[128];
            char date_s[] = new char[16];
            char time_s[] = new char[16];
            char gps_lat[] = new char[16];
            char gps_lgt[] = new char[16];
            char gps_spd[] = new char[16];

            //Step1. Find MOOV
            check_flag = 0;
            while (fis.available()!=-1) {

            }
        }*/
    }
}
